﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication2.UserControls
{
    public partial class Greeting : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            logoutPanel.Visible = false;

            if (Session["FullName"] == null)
            {
                lblGreeting.Text = "No one is logged in .....";
                lblColor.Text = "No color to display .....";
            }
            else
            {
                lblGreeting.Text = "Welcome, " + Session["FullName"].ToString();
                lblColor.Text = "Your favorite color is " + Session["FavoriteColor"].ToString();
                logoutPanel.Visible = true;
            }
            
        }

        protected void lnkLogout_Click(object sender, EventArgs e)
        {
            Session.Abandon();
            Response.Redirect("About.aspx");
        }
    }
}